#include<iostream>
#include<algorithm>

using namespace std;

const int N=1e5+10;

int n,k;
int h[N];


int main()
{
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++) scanf("%d",&h[i]);
	
	sort(h,h+n);
	
	cout<<h[k-1]<<endl;
	return 0;
}

